<template>
	<section>
		<headers :txt="txt+'记录'"></headers>
		<ul class="mu20" v-if="this.$route.query.type==='point'">
			<li class="wallfff bbtm sz28 pud20 plr30" v-for="item in listPoint" >
				<p class="flex_between">
					<span>{{txt}}金额：{{item.Transform_Money | money}}元</span>
					<span>{{item.Transform_OperationTime | tiems}}</span>
				</p>
				 <p class="flex_between mu15">
					<span>到账金额：{{item.Transform_ReceiveMoney | money}}元</span> 
				</p>
			</li>
			<p class="Nomeve" v-if="pointShow">没有记录</p>
			 	
		</ul>
		<ul class="mu20" v-else>
			<li class="wallfff bbtm sz28 pud20 plr30" v-for="item in listCash">
				<p class="flex_between">
					<span>{{txt}}金额：{{item.Draw_Money |money }}元</span>
					<span>{{item.Draw_ApplyTime | tiems}}</span>
				</p>
				 <p class="flex_between mu15">
					<span>到账金额:{{item.Draw_ReceiveMoney | money}}元</span> 
					<button type="button" class="yes_but" v-if="item.Draw_Mark===0" @click="FundDrawCancel(item)">取消</button>
					<button type="button" class="no_but" v-else-if="item.Draw_Mark===9">已取消</button>
					<button type="button" class="no_but" v-else>已转账</button>
				</p>
			</li>
			<p class="Nomeve" v-if="cashShow">没有记录</p>
		</ul>
	</section>
</template>

<script>
	 import { Toast } from 'mint-ui';
	 import { Indicator } from 'mint-ui';
	export default{
		data(){
			return{
				txt: this.$route.query.type==="point"?"转化":"提现",
				listPoint:'',
				listCash:'',
				pointShow:false,
				cashShow:false
			}
		},
		created:function(){
			this.MembersTransform();
		},
		methods:{
			
			MembersTransform:function(){
				Indicator.open();
				if(this.$route.query.type==="point"){
					//积分记录
					this.$http.get('/WorkMembersAsset/V1.0/Work_MembersTransform',{
						params:{
							MembersID: sessionStorage.MembersID
						}
					}).then((res)=>{
						if(!res.data.Return_ID){
							this.listPoint=res.data.Return_Data.PageData;
							console.log(this.listPoint.length);
							if(this.listPoint.length>0){
								this.pointShow=false;
							}else{
								this.pointShow=true;
							}
						}else{
							Toast(res.data.Return_Mess)
						}
						Indicator.close();
					})
				}else{
					//提现记录
					this.$http.get('/WorkMembersAsset/V1.0/GetMembersDraw',{
						params:{
							MembersID: sessionStorage.MembersID
						}
					}).then((res)=>{
						if(!res.data.Return_ID){
							this.listCash=res.data.Return_Data.PageData; 
							if(this.listCash.length>0){
								this.cashShow=false;
							}else{
								this.cashShow=true;
							}
						}else{
							Toast(res.data.Return_Mess)
						}
						Indicator.close();
					})
				}
			},
			FundDrawCancel:function(item){
				Indicator.open();
				this.$http.get('/WorkMembersAsset/V1.0/FundDrawCancel',{
					params:{
						DrawID: item.Draw_ID
					}
				}).then((res)=>{
					if(!res.data.Return_ID){
						Toast("取消成功!")
						this.MembersTransform();
					}else{
						Toast(res.data.Return_Mess)
					}
					Indicator.close();
				});
			}
		},
		filters:{
			tiems:function(val){
				if(!val){
					return ''
				}else{
					 return val.replace(/(T|\.\d+)/gim, " ");
				}
			},
			money:function(val) { 
				if(!val) {
					val = 0.00;
				} else {
					val = Number(val).toFixed(2);
				} 
				return val
			}
		}
		
	}
</script>

<style scoped>
	button{
		padding:0.1066666666rem 0.3333333333rem;
		border-radius:0.0666666666rem;
	}
	.yes_but{
		color: #fff;
		background-color: #DF4444;
	}
	.Nomeve{ 
		text-align: center;
	}
</style>